﻿using System;
using System.Net.NetworkInformation;
using System.Text.Json;
using Microsoft.AspNetCore.Http.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.VisualBasic;
using Quartz.Util;
using Simple.Common.Json;
using Simple.Services.System.QHSEDanger.Models.AnalysisInput;
using Simple.Services.System.QHSEViolationCategory.Models;
using StackExchange.Redis;

namespace Simple.Services;

public class CacheService
{
    private const string UserCacheKey = "u_";
    private const string RoleCacheKey = "r_";


    #region 通用方法

    public async Task RemoveByPrefixAsync(string prefix)
    {
        HashSet<string> keySet = await CacheHelper.GetKeySetAsync();
        var keys = keySet.Where(key => key.StartsWith(prefix)).ToList();
        await CacheHelper.RemoveRangeAsync(keys);
    }

    public async Task<List<TCacheItem>> GetCacheItemsAsync<TCacheItem>(params string[] keys)
    {
        var result = new List<TCacheItem>();

        foreach (var key in keys)
        {
            var cacheItems = await CacheHelper.GetAsync<List<TCacheItem>>(key);
            if (cacheItems != null && cacheItems.Count > 0)
            {
                result.AddRange(cacheItems);
            }
        }

        return result;
    }

    public async Task SetCacheItemAsync<TCacheItem>(string key, List<TCacheItem> cacheItems)
    {
        await CacheHelper.SetAsync(key, cacheItems);
    }

    public async Task RemoveCacheAsync(string key)
    {
        await CacheHelper.RemoveAsync(key);
    }

    #endregion


    #region 清空缓存

    /// <summary>
    /// 清空以角色Id为索引键的缓存
    /// </summary>
    /// <param name="roleId">角色Id</param>
    /// <returns></returns>
    public async Task ClearRoleCacheAsync(string roleId)
    {
        await RemoveRoleApplicationAsync(roleId);
        await RemoveRoleMenuAsync(roleId);
        await RemoveRolePermissionAsync(roleId);
    }

    /// <summary>
    /// 清空 Menu 和 Permission 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearMenuAndPermissionCacheAsync()
    {
        await ClearMenuCacheAsync();
        await ClearPermissionCacheAsync();
    }

    /// <summary>
    /// 清空 Application 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearApplicationCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.Application);
    }
    /// <summary>
    /// 清空 VType 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearVTypeCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEViolationType);
    }
    /// <summary>
    /// 清空 VClause相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearVClauseCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEViolationClause);
    }
    /// <summary>
    /// 清空 DClause相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearDClauseCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEDangerClause);
    }
    /// <summary>
    /// 清空 OverLappingCount相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearOverLappingCountCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEOverLappingCount);
    }
    /// <summary>
    /// 清空QHSEOrg 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearOrgCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEOrganization);
    }
    /// <summary>
    /// 清空 VkeyWorkSpeciality 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearVKeyWorkSpecialityCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEViolationKeyWork);
    }
    /// <summary>
    /// 清空 VCategory 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearVCategoryCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEViolationCategory);
    }
    /// <summary>
    /// 清空 VCategory 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearVSonCategoryCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEViolationCategorySon);
    }
    /// <summary>
    /// 清空 dic 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearDictionaryyCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEDictionary);
    }
    /// <summary>
    /// 清空 Violation 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearViolationCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSESysXyViolation);
    }
    /// <summary>
    /// 清空 Violation 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearHSECacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEViolationHSE);
    }
    /// <summary>
    /// 清空 Danger 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearDangerCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSESysDanger);
    }
    /// <summary>
    /// 清空 Danger 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearDTotalCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEDangerTotal);
    }
    /// <summary>
    /// 清空 Danger 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearVTotalCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.QHSEViolationTotal);
    }
    /// <summary>
    /// 清空 Menu 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearMenuCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.Menu);
    }

    /// <summary>
    /// 清空 Permission 相关的缓存
    /// </summary>
    /// <returns></returns>
    public async Task ClearPermissionCacheAsync()
    {
        await RemoveByPrefixAsync(CacheKeyConst.Permission);
    }

    #endregion

    public async Task<List<ApplicationCacheItem>> GetUserApplicationsAsync(params string[] userIds)
    {
        string[] keys = userIds.Select(item => $"{CacheKeyConst.Application}{UserCacheKey}{item}").ToArray();
        return await GetCacheItemsAsync<ApplicationCacheItem>(keys);
    }

    public async Task<List<ApplicationCacheItem>> GetRoleApplicationsAsync(params string[] roleIds)
    {
        string[] keys = roleIds.Select(item => $"{CacheKeyConst.Application}{RoleCacheKey}{item}").ToArray();
        return await GetCacheItemsAsync<ApplicationCacheItem>(keys);
    }

    public async Task<List<MenuCacheItem>> GetUserMenusAsync(params string[] userIds)
    {
        string[] keys = userIds.Select(item => $"{CacheKeyConst.Menu}{UserCacheKey}{item}").ToArray();
        return await GetCacheItemsAsync<MenuCacheItem>(keys);
    }

    public async Task<List<MenuCacheItem>> GetRoleMenusAsync(params string[] roleIds)
    {
        string[] keys = roleIds.Select(item => $"{CacheKeyConst.Menu}{RoleCacheKey}{item}").ToArray();
        return await GetCacheItemsAsync<MenuCacheItem>(keys);
    }

    public async Task<List<string>> GetUserPermissionsAsync(params string[] userIds)
    {
        string[] keys = userIds.Select(item => $"{CacheKeyConst.Permission}{UserCacheKey}{item}").ToArray();
        return await GetCacheItemsAsync<string>(keys);
    }

    public async Task<List<string>> GetRolePermissionsAsync(params string[] roleIds)
    {
        string[] keys = roleIds.Select(item => $"{CacheKeyConst.Permission}{RoleCacheKey}{item}").ToArray();
        return await GetCacheItemsAsync<string>(keys);
    }

    public async Task SetUserApplicationAsync(string userId, List<ApplicationCacheItem> applications)
    {
        var key = $"{CacheKeyConst.Application}{UserCacheKey}{userId}";
        await SetCacheItemAsync(key, applications);
    }

    public async Task<List<string>> GetPermissionsAsync(string userId)
    {
        string key = $"{CacheKeyConst.Login}{userId}";
        return await GetCacheItemsAsync<string>(key);
    }

    public async Task SetPermissionsAsync(string userId, List<string> permissions)
    {
        string key = $"{CacheKeyConst.Login}{userId}";
        await SetCacheItemAsync<string>(key, permissions);
    }

    public async Task SetRoleApplicationAsync(string roleId, List<ApplicationCacheItem> applications)
    {
        var key = $"{CacheKeyConst.Application}{RoleCacheKey}{roleId}";
        await SetCacheItemAsync(key, applications);
    }

    public async Task SetUserMenuAsync(string userId, List<MenuCacheItem> menus)
    {
        var key = $"{CacheKeyConst.Menu}{UserCacheKey}{userId}";
        await SetCacheItemAsync(key, menus);
    }

    public async Task SetRoleMenuAsync(string roleId, List<MenuCacheItem> menus)
    {
        var key = $"{CacheKeyConst.Menu}{RoleCacheKey}{roleId}";
        await SetCacheItemAsync(key, menus);
    }

    public async Task SetUserPermissionAsync(string userId, List<string> permissions)
    {
        var key = $"{CacheKeyConst.Permission}{UserCacheKey}{userId}";
        await SetCacheItemAsync(key, permissions);
    }

    public async Task SetRolePermissionAsync(string roleId, List<string> permissions)
    {
        var key = $"{CacheKeyConst.Permission}{RoleCacheKey}{roleId}";
        await SetCacheItemAsync(key, permissions);
    }

    public async Task RemoveUserApplicationAsync(string userId)
    {
        var key = $"{CacheKeyConst.Application}{UserCacheKey}{userId}";
        await RemoveCacheAsync(key);
    }

    public async Task RemoveRoleApplicationAsync(string roleId)
    {
        var key = $"{CacheKeyConst.Application}{RoleCacheKey}{roleId}";
        await RemoveCacheAsync(key);
    }

    public async Task RemoveUserMenuAsync(string userId)
    {
        var key = $"{CacheKeyConst.Menu}{UserCacheKey}{userId}";
        await RemoveCacheAsync(key);
    }

    public async Task RemoveRoleMenuAsync(string roleId)
    {
        var key = $"{CacheKeyConst.Menu}{RoleCacheKey}{roleId}";
        await RemoveCacheAsync(key);
    }

    public async Task RemoveUserPermissionAsync(string userId)
    {
        var key = $"{CacheKeyConst.Permission}{UserCacheKey}{userId}";
        await RemoveCacheAsync(key);
    }

    public async Task RemoveRolePermissionAsync(string roleId)
    {
        var key = $"{CacheKeyConst.Permission}{RoleCacheKey}{roleId}";
        await RemoveCacheAsync(key);
    }
    public async Task<List<QHSEXyViolationTypeModel>> GetQHSEViolationTypeAsync(string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationType}{name}";
        return await GetCacheItemsAsync<QHSEXyViolationTypeModel>(key);
    }

    public async Task SetQHSEViolationTypeAsync(List<QHSEXyViolationTypeModel> violations,string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationType}{name}";
        await SetCacheItemAsync(key, violations);
    }
    public async Task<List<QHSEDangerClauseModel>> GetQHSEDangerClauseAsync(string name)
    {
        string key = $"{CacheKeyConst.QHSEDangerClause}{name}";
        return await GetCacheItemsAsync<QHSEDangerClauseModel>(key);
    }

    public async Task SetQHSEDangerClauseAsync(List<QHSEDangerClauseModel> violations,string name)
    {
        string key = $"{CacheKeyConst.QHSEDangerClause}{name}";
        await SetCacheItemAsync(key, violations);
    }
    public async Task<List<QHSEXyViolationClauseModel>> GetQHSEViolationClauseAsync(string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationClause}{name}";
        return await GetCacheItemsAsync<QHSEXyViolationClauseModel>(key);
    }

    public async Task SetQHSEViolationClauseAsync(List<QHSEXyViolationClauseModel> violations, string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationClause}{name}";
        await SetCacheItemAsync(key, violations);
    }
    public async Task<List<QHSEViolationHSEModel>> GetQHSEViolationHSEAsync(string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationHSE}{name}";
        return await GetCacheItemsAsync<QHSEViolationHSEModel>(key);
    }

    public async Task SetQHSEViolationHSEAsync(List<QHSEViolationHSEModel> violations, string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationHSE}{name}";
        await SetCacheItemAsync(key, violations);
    }
    public async Task<List<string>> GetQHSEViolationCategoryAsync(string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationCategory}{name}";
        return await GetCacheItemsAsync<string>(key);
    }

    public async Task SetQHSEViolationCategoryAsync(List<string> violations, string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationCategory}{name}";
        await SetCacheItemAsync(key, violations);
    }

    public async Task<List<string>> GetQHSEOrganizationAsync(string name)
    {
        string key = $"{CacheKeyConst.QHSEOrganization}{name}";
        return await GetCacheItemsAsync<string>(key);
    }

    public async Task SetQHSEOrganizationAsync(List<string> violations, string name)
    {
        string key = $"{CacheKeyConst.QHSEOrganization}{name}";
        await SetCacheItemAsync(key, violations);
    }
    public async Task<List<QHSESysOrganization>> GetQHSEOrganizationSonAsync(string name)
    {
        string key = $"{CacheKeyConst.QHSEOrganizationSon}{name}";
        return await GetCacheItemsAsync<QHSESysOrganization>(key);
    }

    public async Task SetQHSEOrganizationSonAsync(List<QHSESysOrganization> violations, string name)
    {
        string key = $"{CacheKeyConst.QHSEOrganizationSon}{name}";
        await SetCacheItemAsync(key, violations);
    }
    public async Task<List<string>> GetQHSEViolationCategorySonAsync(string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationCategorySon}{name}";
        return await GetCacheItemsAsync<string>(key);
    }

    public async Task SetQHSEViolationCategorySonAsync(List<string> violations, string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationCategorySon}{name}";
        await SetCacheItemAsync(key, violations);
    }
    public async Task<List<QHSEDictionaryModel>> GetQHSEDictionaryuAsync(string code)
    {
        string key = $"{CacheKeyConst.QHSEDictionary}{code}";
        return await GetCacheItemsAsync<QHSEDictionaryModel>(key);
    }

    public async Task SetQHSEDictionaryuAsync(List<QHSEDictionaryModel> violations, string code)
    {
        string key = $"{CacheKeyConst.QHSEDictionary}{code}";
        await SetCacheItemAsync(key, violations);
    }
    public async Task<List<QHSEKeyWorkSpecialtyModel>> GetQHSEViolationKeyWorkSpecialityAsync(string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationKeyWork}{name}";
        return await GetCacheItemsAsync<QHSEKeyWorkSpecialtyModel>(key);
    }

    public async Task SetQHSEViolationKeyWorkSpecialityAsync(List<QHSEKeyWorkSpecialtyModel> violations, string name)
    {
        string key = $"{CacheKeyConst.QHSEViolationKeyWork}{name}";
        await SetCacheItemAsync(key, violations);
    }

    public async Task<List<QHSESysXyViolation>> GetQHSEViolationsAsync(params string[] violationIds)
    {
        string[] keys = violationIds.Select(item => $"{CacheKeyConst.QHSESysXyViolation}{item}").ToArray();
        return await GetCacheItemsAsync<QHSESysXyViolation>(keys);
    }

    public async Task SetQHSEViolationsAsync(List<QHSESysXyViolation> violations)
    {
        var keys = violations.Select(violation => $"{CacheKeyConst.QHSESysXyViolation}{violation.QhseXyViolationId}").ToArray();
        await SetCacheItemAsync(keys[0], violations);
    }

    public async Task RemoveQHSEViolationAsync(string violationId)
    {
        var key = $"{CacheKeyConst.QHSESysXyViolation}{violationId}";
        await RemoveCacheAsync(key);
    }
    public async Task<QHSEXyViolationModel> GetQHSESysXyViolationByIdAsync(string vid)
    {
        string cacheKey = $"{"GMHV"}{vid}";
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromSeconds(10).Ticks)
            {
                var jsonSerializerOptions = new JsonSerializerOptions();
                jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (string.IsNullOrEmpty(jsonData))
                    return null;

                return JsonSerializer.Deserialize<QHSEXyViolationModel>(jsonData, jsonSerializerOptions);
            }
        }
        return null;
    }

    public async Task<QHSEDangerModel> GetQHSESysDangerByIdAsync(string Did)
    {
        string cacheKey = $"{"GMHD"}{Did}";
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromSeconds(10).Ticks)
            {
                var jsonSerializerOptions = new JsonSerializerOptions();
                jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (string.IsNullOrEmpty(jsonData))
                    return null;

                return JsonSerializer.Deserialize<QHSEDangerModel>(jsonData, jsonSerializerOptions);
            }
        }
        return null;
    }

    public async Task SetQHSESysDangerByIdAsync(string Did, QHSEDangerModel danger)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        var key = $"{"GMHD"}{Did}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{key}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(danger, jsonSerializerOptions);
        await CacheHelper.SetAsync(key, jsonData);
    }

    public async Task SetQHSESysXyViolationByIdAsync(string vid, QHSEXyViolationModel violation)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        var key = $"{"GMHV"}{vid}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{key}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(violation, jsonSerializerOptions);
        await CacheHelper.SetAsync(key, jsonData);
    }


    public async Task<PageResultModel<QHSEXyViolationModel>> GetViolationPageResultAsync(ViolationPageInputModel input)
    {
        string cacheKey = $"{CacheKeyConst.QHSESysXyViolation}{input.PageNo}-{input.PageSize}-{input.CheckType}-{input.OrganizationId}-{input.OrganizationName}-{input.UserName}-{input.TimeOn}-{input.TimeEnd}";
        var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

        if (jsonData != null)
        {
            var jsonSerializerOptions = new JsonSerializerOptions();
            jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
            return JsonSerializer.Deserialize<PageResultModel<QHSEXyViolationModel>>(jsonData, jsonSerializerOptions);
        }

        return null; // 根据业务需求返回合适的默认值
    }

    public async Task SetViolationPageResultAsync(ViolationPageInputModel input, PageResultModel<QHSEXyViolationModel> result)
    {
        string cacheKey = $"{CacheKeyConst.QHSESysXyViolation}{input.PageNo}-{input.PageSize}-{input.CheckType}-{input.OrganizationId}-{input.OrganizationName}-{input.UserName}-{input.TimeOn}-{input.TimeEnd}";

        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }


    public async Task<PageResultModel<QHSEDangerModel>> GetDangerPageResultAsync(DangerPageInputModel input)
    {
        
        string cacheKey = $"{CacheKeyConst.QHSESysDanger}{input.PageNo}-{input.PageSize}-{input.CheckType}" +
            $"-{input.Status}-{input.DangerType}-{input.CheckOrganizationId}-{input.CheckOrganizationName}-{input.DangerOrganizationId}-{input.DangerOrganizationName}-{input.UserName}-{input.TimeOn}-{input.TimeEnd}";
        var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

        if (jsonData != null)
        {
            var jsonSerializerOptions = new JsonSerializerOptions();
            jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
            return JsonSerializer.Deserialize<PageResultModel<QHSEDangerModel>>(jsonData, jsonSerializerOptions);
        }

        return null; // 根据业务需求返回合适的默认值
    }

    public async Task SetDangerPageResultAsync(DangerPageInputModel input, PageResultModel<QHSEDangerModel> result)
    {
        string cacheKey = $"{CacheKeyConst.QHSESysDanger}{input.PageNo}-{input.PageSize}-{input.CheckType}" +
            $"-{input.Status}-{input.DangerType}-{input.CheckOrganizationId}-{input.CheckOrganizationName}-{input.DangerOrganizationId}-{input.DangerOrganizationName}-{input.UserName}-{input.TimeOn}-{input.TimeEnd}";

        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<PageResultModel<QHSEDangerModel>> GetComDangerPageResultAsync(ComDangerPageInputModel input)
    {
        string checkTypes = string.Join("-", input.CheckTypes);
        string workSpecialty = string.Join("-", input.WorkSpecialty);
        string workType = string.Join("-", input.WorkType);
        string workContent = string.Join("-", input.WorkRisk);
        string location = string.Join("-", input.Location);
        string dangerCategory= string.Join("-", input.DangerCategory);
        string status =  string.Join("-", input.Status);
        string dangerType = string.Join("-", input.DangerType);
        string enterSys = string.Join("-", input.EnterSys);
        string cacheKey = $"{CacheKeyConst.QHSESysDanger}{input.PageNo}-{input.PageSize}-{checkTypes}" +
            $"-{status}-{dangerType}-{input.CheckOrganizationId}-{input.CheckOrganizationName}-{input.DangerOrganizationId}-{input.DangerOrganizationName}" +
            $"-{input.UserName}-{input.TimeOn}-{input.TimeEnd}-{workSpecialty}-{workType}-{dangerCategory}" +
            $"-{workContent}-{location}-{enterSys}-{input.ErpNo}";
        var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

        if (jsonData != null)
        {
            var jsonSerializerOptions = new JsonSerializerOptions();
            jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
            return JsonSerializer.Deserialize<PageResultModel<QHSEDangerModel>>(jsonData, jsonSerializerOptions);
        }

        return null; // 根据业务需求返回合适的默认值
    }

    public async Task SetComDangerPageResultAsync(ComDangerPageInputModel input, PageResultModel<QHSEDangerModel> result)
    {
        string checkTypes = string.Join("-", input.CheckTypes);
        string workSpecialty = string.Join("-", input.WorkSpecialty);
        string workType = string.Join("-", input.WorkType);
        string workContent = string.Join("-", input.WorkRisk);
        string location = string.Join("-", input.Location);
        string dangerCategory = string.Join("-", input.DangerCategory);
        string status = string.Join("-", input.Status);
        string dangerType = string.Join("-", input.DangerType);
        string enterSys = string.Join("-", input.EnterSys);
        string cacheKey = $"{CacheKeyConst.QHSESysDanger}{input.PageNo}-{input.PageSize}-{checkTypes}" +
            $"-{status}-{dangerType}-{input.CheckOrganizationId}-{input.CheckOrganizationName}-{input.DangerOrganizationId}-{input.DangerOrganizationName}" +
            $"-{input.UserName}-{input.TimeOn}-{input.TimeEnd}-{workSpecialty}-{workType}-{dangerCategory}" +
            $"-{workContent}-{location}-{enterSys}-{input.ErpNo}";
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<PageResultModel<QHSEDangerModel>> GetComDangerPageExResultAsync(ComDangerPageInputModel input)
    {
        string checkTypes = string.Join("-", input.CheckTypes);
        string workSpecialty = string.Join("-", input.WorkSpecialty);
        string workType = string.Join("-", input.WorkType);
        string workContent = string.Join("-", input.WorkRisk);
        string location = string.Join("-", input.Location);
        string dangerCategory = string.Join("-", input.DangerCategory);
        string status = string.Join("-", input.Status);
        string dangerType = string.Join("-", input.DangerType);
        string enterSys = string.Join("-", input.EnterSys);
        string cacheKey = $"{CacheKeyConst.QHSESysDanger}{input.PageNo}-{input.PageSize}-{checkTypes}" +
            $"-{status}-{dangerType}-{input.CheckOrganizationId}-{input.CheckOrganizationName}-{input.DangerOrganizationId}-{input.DangerOrganizationName}" +
            $"-{input.UserName}-{input.TimeOn}-{input.TimeEnd}-{workSpecialty}-{workType}-{dangerCategory}" +
            $"-{workContent}-{location}-{enterSys}-{input.ErpNo}";
        var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

        if (jsonData != null)
        {
            var jsonSerializerOptions = new JsonSerializerOptions();
            jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
            return JsonSerializer.Deserialize<PageResultModel<QHSEDangerModel>>(jsonData, jsonSerializerOptions);
        }

        return null; // 根据业务需求返回合适的默认值
    }

    public async Task SetComDangerPageExResultAsync(ComDangerPageInputModel input, PageResultModel<QHSEDangerModel> result)
    {
        string checkTypes = string.Join("-", input.CheckTypes);
        string workSpecialty = string.Join("-", input.WorkSpecialty);
        string workType = string.Join("-", input.WorkType);
        string workContent = string.Join("-", input.WorkRisk);
        string location = string.Join("-", input.Location);
        string dangerCategory = string.Join("-", input.DangerCategory);
        string status = string.Join("-", input.Status);
        string dangerType = string.Join("-", input.DangerType);
        string enterSys = string.Join("-", input.EnterSys);
        string cacheKey = $"{CacheKeyConst.QHSESysDanger}{input.PageNo}-{input.PageSize}-{checkTypes}" +
            $"-{status}-{dangerType}-{input.CheckOrganizationId}-{input.CheckOrganizationName}-{input.DangerOrganizationId}-{input.DangerOrganizationName}" +
            $"-{input.UserName}-{input.TimeOn}-{input.TimeEnd}-{workSpecialty}-{workType}-{dangerCategory}" +
            $"-{workContent}-{location}-{enterSys}-{input.ErpNo}";
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<PageResultModel<QHSEXyViolationModel>> GetComViolationPageResultAsync(ComViolationPageInputModel input)
    {
        string checkTypes = string.Join("-", input.CheckTypes);
        string workSpecialty = string.Join("-", input.WorkSpecialty);
        string workType = string.Join("-", input.WorkType);
        string workContent = string.Join("-", input.WorkRisk);
        string location = string.Join("-", input.Location);
        string position = string.Join("-", input.Position);
        string age = string.Join("-", input.Age);
        string workYears = string.Join("-", input.WorkYears);
        string violationType = string.Join("-", input.ViolationType);
        string employeeType = string.Join("-", input.EmployeeType);
        string enterSys = string.Join("-", input.EnterSys);
        string cacheKey = $"{CacheKeyConst.QHSESysXyViolation}{input.PageNo}-{input.PageSize}" +
            $"-{checkTypes}-{input.OrganizationId}-{input.OrganizationName}-{input.UserName}-{input.TimeOn}-{input.TimeEnd}" +
            $"-{workSpecialty}-{workType}-{workContent}-{location}-{position}" +
            $"{age}-{workYears}-{violationType}-{input.ViolationCategory}-{input.Fine}-{input.FineSymbol}" +
            $"-{input.Score}-{input.ScoreSymbol}-{input.CheckOrganizationId}-{input.CheckOrganizationName}-{input.UserId}-{employeeType}-{enterSys}";
        var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

        if (jsonData != null)
        {
            var jsonSerializerOptions = new JsonSerializerOptions();
            jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
            return JsonSerializer.Deserialize<PageResultModel<QHSEXyViolationModel>>(jsonData, jsonSerializerOptions);
        }

        return null; // 根据业务需求返回合适的默认值
    }

    public async Task SetComViolationPageResultAsync(ComViolationPageInputModel input, PageResultModel<QHSEXyViolationModel> result)
    {
        string checkTypes = string.Join("-", input.CheckTypes);
        string workSpecialty = string.Join("-", input.WorkSpecialty);
        string workType = string.Join("-", input.WorkType);
        string workContent = string.Join("-", input.WorkRisk);
        string location = string.Join("-", input.Location);
        string position = string.Join("-", input.Position);
        string age = string.Join("-", input.Age);
        string workYears = string.Join("-", input.WorkYears);
        string violationType = string.Join("-", input.ViolationType);
        string employeeType = string.Join("-", input.EmployeeType);
        string enterSys = string.Join("-", input.EnterSys);
        string cacheKey = $"{CacheKeyConst.QHSESysXyViolation}{input.PageNo}-{input.PageSize}" +
            $"-{checkTypes}-{input.OrganizationId}-{input.OrganizationName}-{input.UserName}-{input.TimeOn}-{input.TimeEnd}" +
            $"-{workSpecialty}-{workType}-{workContent}-{location}-{position}" +
            $"{age}-{workYears}-{violationType}-{input.ViolationCategory}-{input.Fine}-{input.FineSymbol}" +
            $"-{input.Score}-{input.ScoreSymbol}-{input.CheckOrganizationId}-{input.CheckOrganizationName}-{input.UserId}-{employeeType}-{enterSys}";
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<PageResultModel<QHSEXyViolationModel>> GetComViolationPageExResultAsync(ComViolationPageInputModel input)
    {
        string checkTypes = string.Join("-", input.CheckTypes);
        string workSpecialty = string.Join("-", input.WorkSpecialty);
        string workType = string.Join("-", input.WorkType);
        string workContent = string.Join("-", input.WorkRisk);
        string location = string.Join("-", input.Location);
        string position = string.Join("-", input.Position);
        string age = string.Join("-", input.Age);
        string workYears = string.Join("-", input.WorkYears);
        string violationType = string.Join("-", input.ViolationType);
        string employeeType = string.Join("-", input.EmployeeType);
        string enterSys = string.Join("-", input.EnterSys);
        string cacheKey = $"{CacheKeyConst.QHSESysXyViolation}{input.PageNo}-{input.PageSize}" +
            $"-{checkTypes}-{input.OrganizationId}-{input.OrganizationName}-{input.UserName}-{input.TimeOn}-{input.TimeEnd}" +
            $"-{workSpecialty}-{workType}-{workContent}-{location}-{position}" +
            $"{age}-{workYears}-{violationType}-{input.ViolationCategory}-{input.Fine}-{input.FineSymbol}" +
            $"-{input.Score}-{input.ScoreSymbol}-{input.CheckOrganizationId}-{input.CheckOrganizationName}-{input.UserId}-{employeeType}-{enterSys}";
        var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

        if (jsonData != null)
        {
            var jsonSerializerOptions = new JsonSerializerOptions();
            jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
            return JsonSerializer.Deserialize<PageResultModel<QHSEXyViolationModel>>(jsonData, jsonSerializerOptions);
        }

        return null; // 根据业务需求返回合适的默认值
    }

    public async Task SetComViolationPageExResultAsync(ComViolationPageInputModel input, PageResultModel<QHSEXyViolationModel> result)
    {
        string checkTypes = string.Join("-", input.CheckTypes);
        string workSpecialty = string.Join("-", input.WorkSpecialty);
        string workType = string.Join("-", input.WorkType);
        string workContent = string.Join("-", input.WorkRisk);
        string location = string.Join("-", input.Location);
        string position = string.Join("-", input.Position);
        string age = string.Join("-", input.Age);
        string workYears = string.Join("-", input.WorkYears);
        string violationType = string.Join("-", input.ViolationType);
        string employeeType = string.Join("-", input.EmployeeType);
        string enterSys = string.Join("-", input.EnterSys);
        string cacheKey = $"{CacheKeyConst.QHSESysXyViolation}{input.PageNo}-{input.PageSize}" +
            $"-{checkTypes}-{input.OrganizationId}-{input.OrganizationName}-{input.UserName}-{input.TimeOn}-{input.TimeEnd}" +
            $"-{workSpecialty}-{workType}-{workContent}-{location}-{position}" +
            $"{age}-{workYears}-{violationType}-{input.ViolationCategory}-{input.Fine}-{input.FineSymbol}" +
            $"-{input.Score}-{input.ScoreSymbol}-{input.CheckOrganizationId}-{input.CheckOrganizationName}-{input.UserId}-{employeeType}-{enterSys}";
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<PageResultModel<ViolationTotalResultModel>> GetViolationTotalQueryAsync(ViolationTotalInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationTotal}{input.PageNo}-{input.PageSize}-{input.TimeOn}-{input.TimeEnd}-{input.InspectionMethod}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<PageResultModel<ViolationTotalResultModel>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetViolationTotalQueryAsync(ViolationTotalInputModel input, PageResultModel<ViolationTotalResultModel> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationTotal}{input.PageNo}-{input.PageSize}-{input.TimeOn}-{input.TimeEnd}-{input.InspectionMethod}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<PageResultModel<ViolationTotalResultModel>> GetDangerTotalQueryAsync(ViolationTotalInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerTotal}{input.PageNo}-{input.PageSize}-{input.TimeOn}-{input.TimeEnd}-{input.InspectionMethod}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<PageResultModel<ViolationTotalResultModel>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDangerTotalQueryAsync(ViolationTotalInputModel input, PageResultModel<ViolationTotalResultModel> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerTotal}{input.PageNo}-{input.PageSize}-{input.TimeOn}-{input.TimeEnd}-{input.InspectionMethod}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    //隐患级别分析缓存
    public async Task<List<DangerAnalysisResult>> GetDangerTypeDangerTypeAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEDangerTypeDangerTypeAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDangerTypeDangerTypeAnalysisAsync(DangerAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEDangerTypeDangerTypeAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    
    public async Task<CompareDangerAnalysisResult> GetDangerTypeDangerTypeCategoryAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEDangerTypeDangerTypeCategoryAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareDangerAnalysisResult>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDangerTypeDangerTypeCategoryAnalysisAsync(DangerAnalysisInput input, CompareDangerAnalysisResult result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEDangerTypeDangerTypeCategoryAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareDangerAnalysisResult> GetDangerTypeWorkSpecialityAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEDangerTypeWorkSpecialityAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareDangerAnalysisResult>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDangerTypeWorkSpecialityAnalysisAsync(DangerAnalysisInput input, CompareDangerAnalysisResult result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEDangerTypeWorkSpecialityAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareDangerAnalysisResult> GetDangerTypeDangerStatusAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEDangerTypeDangerStatusAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareDangerAnalysisResult>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDangerTypeDangerStatusAnalysisAsync(DangerAnalysisInput input, CompareDangerAnalysisResult result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEDangerTypeDangerStatusAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareDangerAnalysisResult> GetDangerTypeDangerCategoryAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEDangerTypeDangerCategoryAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareDangerAnalysisResult>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDangerTypeDangerCategoryAnalysisAsync(DangerAnalysisInput input, CompareDangerAnalysisResult result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEDangerTypeDangerCategoryAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    //隐患关键作业
    public async Task<List<DangerAnalysisResult>> GetKeyWorkKeyWorkAnalysisAsync(DangerKeyWorkInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string keyWork = string.Join("-", input.KeyWorks);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEKeyWorkKeyWorkAnalysis}{checkTypes}-{workSpecialty}-{keyWork}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetKeyWorkKeyWorkAnalysisAsync(DangerKeyWorkInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string keyWork = string.Join("-", input.KeyWorks);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEKeyWorkKeyWorkAnalysis}{checkTypes}-{workSpecialty}-{keyWork}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareDangerAnalysisResult> GetKeyWorkDangerTypeAnalysisAsync(DangerKeyWorkInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string keyWork = string.Join("-", input.KeyWorks);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEKeyWorkDangerTypeAnalysis}{checkTypes}-{workSpecialty}-{keyWork}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareDangerAnalysisResult>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetKeyWorkDangerTypeAnalysisAsync(DangerKeyWorkInput input, CompareDangerAnalysisResult result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string keyWork = string.Join("-", input.KeyWorks);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEKeyWorkDangerTypeAnalysis}{checkTypes}-{workSpecialty}-{keyWork}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareDangerAnalysisResult> GetKeyWorkDangerStatusAnalysisAsync(DangerKeyWorkInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string keyWork = string.Join("-", input.KeyWorks);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEKeyWorkDangerStatusAnalysis}{checkTypes}-{workSpecialty}-{keyWork}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareDangerAnalysisResult>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetKeyWorkDangerStatusAnalysisAsync(DangerKeyWorkInput input, CompareDangerAnalysisResult result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string keyWork = string.Join("-", input.KeyWorks);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEKeyWorkDangerStatusAnalysis}{checkTypes}-{workSpecialty}-{keyWork}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareDangerAnalysisResult> GetKeyWorkDangerCategoryAnalysisAsync(DangerKeyWorkInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string keyWork = string.Join("-", input.KeyWorks);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEKeyWorkDangerCategoryAnalysis}{checkTypes}-{workSpecialty}-{keyWork}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareDangerAnalysisResult>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetKeyWorkDangerCategoryAnalysisAsync(DangerKeyWorkInput input, CompareDangerAnalysisResult result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string keyWork = string.Join("-", input.KeyWorks);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSEKeyWorkDangerCategoryAnalysis}{checkTypes}-{workSpecialty}-{keyWork}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    //隐患类别
    public async Task<List<DangerAnalysisResult>> GetDangerCategoryDangerCategoryAnalysisAsync(DangerSpecialtyAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSECategoryDangerCategoryAnalysis}{checkTypes}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDangerCategoryDangerCategoryAnalysisAsync(DangerSpecialtyAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSECategoryDangerCategoryAnalysis}{checkTypes}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetDangerCategoryDangerTypeAnalysisAsync(DangerSpecialtyAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSECategoryDangerTypeAnalysis}{checkTypes}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDangerCategoryDangerTypeAnalysisAsync(DangerSpecialtyAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSECategoryDangerTypeAnalysis}{checkTypes}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetDangerCategoryDangerCauseAnalysisAsync(DangerSpecialtyAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSECategoryDangerCauseAnalysis}{checkTypes}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDangerCategoryDangerCauseAnalysisAsync(DangerSpecialtyAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSECategoryDangerCauseAnalysis}{checkTypes}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<DangerAnalysisResult>> GetDangerCategoryDirectDepartmentAnalysisAsync(DangerSpecialtyAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSECategoryDirectDepartmentAnalysis}{checkTypes}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDangerCategoryDirectDepartmentAnalysisAsync(DangerSpecialtyAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSECategoryDirectDepartmentAnalysis}{checkTypes}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetDangerCategoryHSEAnalysisAsync(DangerSpecialtyAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSECategoryHSEAnalysis}{checkTypes}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDangerCategoryHSEAnalysisAsync(DangerSpecialtyAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSECategoryHSEAnalysis}{checkTypes}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    //隐患总体分析
    public async Task<List<DangerAnalysisResult>> GetTotalCategoryAnalysisAsync(DangerCategoryInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSETotalCategoryAnalysis}{checkTypes}-{input.TotalDate}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTotalCategoryAnalysisAsync(DangerCategoryInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string cacheKey = $"{CacheKeyConst.QHSETotalCategoryAnalysis}{checkTypes}-{input.TotalDate}-{input.DangerCategory}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetTotalTypeAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalTypeAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTotalTypeAnalysisAsync(DangerAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalTypeAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetTotalCauseAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalCauseAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTotalCauseAnalysisAsync(DangerAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalCauseAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetTotalDirectDepartmentAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalDirectDepartmentAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTotalDirectDepartmentAnalysisAsync(DangerAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalDirectDepartmentAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetTotalHseAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalHseAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTotalHseAnalysisAsync(DangerAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalHseAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetTotalSpecialtyAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalSpecialtyAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTotalSpecialtyAnalysisAsync(DangerAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalSpecialtyAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetTotalTypeCategoryAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalTypeCategoryAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTotalTypeCategoryAnalysisAsync(DangerAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalTypeCategoryAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetTotalSecondaryUnitAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalSecondaryUnitAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTotalSecondaryUnitAnalysisAsync(DangerAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalSecondaryUnitAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetTotalTrendAnalysisAsync(DangerTrendInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalTrendAnalysis}{checkTypes}-{input.TotalDate}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTotalTrendAnalysisAsync(DangerTrendInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalTrendAnalysis}{checkTypes}-{input.TotalDate}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetTotalStatusAnalysisAsync(DangerAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalStatusAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTotalStatusAnalysisAsync(DangerAnalysisInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalStatusAnalysis}{checkTypes}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    //隐患专业分析
    public async Task<List<DangerAnalysisResult>> GetSpecialityDangerSpecialtyAnalysisAsync(DangerSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDangerSpecialtyAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityDangerSpecialtyAnalysisAsync(DangerSpecialityInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDangerSpecialtyAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetSpecialityKeyWorkAnalysisAsync(DangerSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityKeyWorkAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityKeyWorkAnalysisAsync(DangerSpecialityInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityKeyWorkAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetSpecialityDangerTypeAnalysisAsync(DangerSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDangerTypeAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityDangerTypeAnalysisAsync(DangerSpecialityInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDangerTypeAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetSpecialityDangerTypeCategoryAnalysisAsync(DangerSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDangerTypeCategoryAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityDangerTypeCategoryAnalysisAsync(DangerSpecialityInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDangerTypeCategoryAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetSpecialityLocationAnalysisAsync(DangerSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityLocationAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityLocationAnalysisAsync(DangerSpecialityInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityLocationAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetSpecialityStatusAnalysisAsync(DangerSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityStatusAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityStatusAnalysisAsync(DangerSpecialityInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityStatusAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetSpecialityHseAnalysisAsync(DangerSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityHseAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityHseAnalysisAsync(DangerSpecialityInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityHseAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetSpecialityDirectDepartmentAnalysisAsync(DangerSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDirectDepartmentAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityDirectDepartmentAnalysisAsync(DangerSpecialityInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDirectDepartmentAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetSpecialityDangerCauseAnalysisAsync(DangerSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDangerCauseAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityDangerCauseAnalysisAsync(DangerSpecialityInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDangerCauseAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<DangerAnalysisResult>> GetSpecialityDangerCategoryAnalysisAsync(DangerCategoryInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDangerCategoryAnalysis}{checkTypes}-{input.DangerCategory}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityDangerCategoryAnalysisAsync(DangerCategoryInput input, List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialityDangerCategoryAnalysis}{checkTypes}-{input.DangerCategory}-{input.TotalDate}-{workSpecialty}-{input.DangerOrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    //违章专业分析
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationAgeAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationAgeAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationAgeAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationAgeAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationKeyWorkTypeAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationKeyWorkAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationKeyWorkTypeAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationKeyWorkAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationPositionAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationPosistionAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationPositionAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationPosistionAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationLocationAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationLocationAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationLocationAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationLocationAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationTypeAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationTypeAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationTypeAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationTypeAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationTypeCategoryAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationTypeCategoryAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationTypeCategoryAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationTypeCategoryAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationCauseAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationCauseAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationCauseAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationCauseAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationDirectDepartmentAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationDirectDepartmentAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationDirectDepartmentAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationDirectDepartmentAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationHSEElementAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationHseAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationHSEElementAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationHseAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationWorkYearsAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationWorkYearsAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationWorkYearsAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationWorkYearsAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationEmployeeTypeAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationEmployeeTypeAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationEmployeeTypeAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationEmployeeTypeAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationCategoryAnalysisAsync(ViolationSpecialtyAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationCategoryAnalysis}{checkTypes}-{input.ViolationCategory}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationCategoryAnalysisAsync(ViolationSpecialtyAnalysisInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationCategoryAnalysis}{checkTypes}-{input.ViolationCategory}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetSpecialityViolationTrendAnalysisAsync(ViolationSpecialityInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationTrendAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSpecialityViolationTrendAnalysisAsync(ViolationSpecialityInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string workSpecialty = string.Join("-", input.WorkSpeciality);
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSESpecialtyViolationTrendAnalysis}{checkTypes}-{input.TotalDate}-{workSpecialty}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<QHSEVadTotalResultModel> GetPageAnalysisTotalAsync()
    {
        string cacheKey = $"{CacheKeyConst.QHSEAnDTotal}";
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string timestampKey = $"{cacheKey}-Timestamp";

        // Verify that the cache is within the 60-minute window
        var timestamp = await CacheHelper.GetAsync<string>(timestampKey);
        if (timestamp != null && long.TryParse(timestamp, out long cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(720).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);
                if (!string.IsNullOrEmpty(jsonData))
                {
                    try
                    {
                        var result = JsonSerializer.Deserialize<QHSEVadTotalResultModel>(jsonData);
                        if (result != null)
                        {
                            return result;
                        }
                    }
                    catch (JsonException ex)
                    {
                        // Log exception or handle it
                        Console.WriteLine($"JSON deserialization error: {ex.Message}");
                    }
                }
            }
        }

        return null; // Return default value if cache is invalid or not found
    }

    public async Task SetPageAnalysisTotalAsync(QHSEVadTotalResultModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnDTotal}";

        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());

        var jsonData = JsonSerializer.Serialize(result);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }



    public async Task<List<DangerAnalysisResult>> GetPageAnalysisDTypeAsync()
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisDangerType}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(720).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetPageAnalysisDTypeAsync(List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisDangerType}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<ViolationAnalysisResult>> GetPageAnalysisVTypeAsync()
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisViolationType}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(720).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetPageAnalysisVTypeAsync(List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisViolationType}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<ViolationAnalysisResult>> GetPageAnalysisVSpecialtyAsync()
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisViolationSpecialty}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(720).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetPageAnalysisVSpecialtyAsync(List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisViolationSpecialty}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<DangerAnalysisResult>> GetPageAnalysisDSpecialtyAsync()
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisDangerSpecialty}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(720).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetPageAnalysisDSpecialtyAsync(List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisDangerSpecialty}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<DangerAnalysisResult>> GetPageAnalysisDSecondaryAsync()
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisDangerSecondary}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(720).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<DangerAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetPageAnalysisDSecondaryAsync(List<DangerAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisDangerSecondary}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<ViolationAnalysisResult>> GetPageAnalysisVSecondaryAsync()
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisViolationSecondary}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(720).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetPageAnalysisVSecondaryAsync(List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEAnalysisViolationSecondary}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    //交叉方统计
    public async Task<PageResultModel<OverLappingVadPageResultModel>> GetOverLappingCountAsync(OverLappingVadPageInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEOverLappingCount}-{input.TimeEnd}-{input.TimeOn}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(720).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<PageResultModel<OverLappingVadPageResultModel>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetOverLappingCountAsync(OverLappingVadPageInputModel input, PageResultModel<OverLappingVadPageResultModel> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEOverLappingCount}-{input.TimeEnd}-{input.TimeOn}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    //违章整体分析缓存
    public async Task<List<ViolationAnalysisResult>> GetWorkSpecialtyAnalysisAsync(ViolationAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationSpecialtyAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetWorkSpecialtyAnalysisAsync(ViolationAnalysisInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationSpecialtyAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<ViolationAnalysisResult>> GetViolationTrendAnalysisAsync(ViolationTrendInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationTrendAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}-{input.TotalDate}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetViolationTrendAnalysisAsync(ViolationTrendInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationTrendAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}-{input.TotalDate}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<ViolationAnalysisResult>> GetSecondaryUnitAnalysisAsync(ViolationAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationSecondaryUnitAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetSecondaryUnitAnalysisAsync(ViolationAnalysisInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationSecondaryUnitAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetViolationTypeAnalysisAsync(ViolationAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationTypeAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetViolationTypeAnalysisAsync(ViolationAnalysisInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationTypeAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<ViolationAnalysisResult>> GetViolationCauseAnalysisAsync(ViolationAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationCauseAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetViolationCauseAnalysisAsync(ViolationAnalysisInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationCauseAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<ViolationAnalysisResult>> GetViolationTypeCategoryAnalysisAsync(ViolationAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationTypeCategoryAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetViolationTypeCategoryAnalysisAsync(ViolationAnalysisInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationTypeCategoryAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetDirectDepartmentAnalysisAsync(ViolationAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationDirectDepartmentAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetDirectDepartmentAnalysisAsync(ViolationAnalysisInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationDirectDepartmentAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<List<ViolationAnalysisResult>> GetHseElementAnalysisAsync(ViolationAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationHseAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetHseElementAnalysisAsync(ViolationAnalysisInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationHseAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<ViolationAnalysisResult>> GetWorkYearAnalysisAsync(ViolationAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationWorkYearsAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetWorkYearAnalysisAsync(ViolationAnalysisInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationWorkYearsAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<ViolationAnalysisResult>> GetAgeAnalysisAsync(ViolationAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationAgeAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetAgeAnalysisAsync(ViolationAnalysisInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationAgeAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<ViolationAnalysisResult>> GetEmployeeTypeAnalysisAsync(ViolationAnalysisInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationEmployeeTypeAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetEmployeeTypeAnalysisAsync(ViolationAnalysisInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationEmployeeTypeAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task<List<ViolationAnalysisResult>> GetViolationCategoryAnalysisAsync(ViolationCategoryInput input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationCategoryAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}-{input.ViolationCategory}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromMinutes(60).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<ViolationAnalysisResult>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetViolationCategoryAnalysisAsync(ViolationCategoryInput input, List<ViolationAnalysisResult> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", input.CheckType);
        string cacheKey = $"{CacheKeyConst.QHSETotalViolationCategoryAnalysis}{checkTypes}-{input.OrganizationId}-{input.CheckOrganizationId}-{input.TimeOn}-{input.TimeEnd}-{input.ViolationCategory}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    //违章报表缓存
    public async Task<List<TableReport>> GetTableViolationTotalCheckCountAsync(QHSETotalInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportTableTotal}-{input.OrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableViolationTotalCheckCountAsync(QHSETotalInputModel input, List<TableReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportTableTotal}-{input.OrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task SetCompareViolationDepartmentCheckCountAsync(QHSEReportInputModel input, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareViolationDepartmentCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableCompareReport>> GetTableViolationDepartmentCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportTableDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableCompareReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableViolationTotalCheckCountAsync(QHSEReportInputModel input, List<TableCompareReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportTableDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task SetCompareViolationTypeCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareVType}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareViolationTypeCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareVType}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableViolationTypeCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareVType}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableViolationTypeCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareVType}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task SetCompareViolationCategoryCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareVCategory}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareViolationCategoryCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareVCategory}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableViolationCategoryCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareVCategory}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableViolationCategoryCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareVCategory}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task SetCompareViolationAgeCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareAge}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareViolationAgeCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareAge}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableViolationAgeCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareAge}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableViolationAgeCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareAge}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task SetCompareViolationDirectDepartmentCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareDirectDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareViolationDirectDepartmentCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareDirectDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableViolationDirectDepartmentCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareDirectDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableViolationDirectDepartmentCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareDirectDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task SetCompareViolationSpecialtyCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareSpecialty}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareViolationSpecialtyCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareSpecialty}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableViolationSpecialtyCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareSpecialty}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableViolationSpecialtyCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareSpecialty}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task SetCompareViolationKeyWorkCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareKeyWork}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareViolationKeyWorkCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareKeyWork}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableViolationKeyWorkCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareKeyWork}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableViolationKeyWorkCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareKeyWork}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task SetCompareViolationHSECheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareHSE}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareViolationHSECheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareHSE}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableViolationHSECheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareHSE}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableViolationHSECheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareHSE}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task SetCompareViolationOBSCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareOBS}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareViolationOBSCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareOBS}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableViolationOBSCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareOBS}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableViolationOBSCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEViolationReportCompareOBS}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    //隐患报表缓存

    public async Task<List<TableReport>> GetTableDangerTotalCheckCountAsync(QHSETotalInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportTableTotal}-{input.OrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableDangerTotalCheckCountAsync(QHSETotalInputModel input, List<TableReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportTableTotal}-{input.OrganizationId}-{input.TimeOn}-{input.TimeEnd}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task SetCompareDangerDepartmentCheckCountAsync(QHSEReportInputModel input, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareDangerDepartmentCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableCompareReport>> GetTableDangerDepartmentCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportTableDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableCompareReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableDangerDepartmentCheckCountAsync(QHSEReportInputModel input, List<TableCompareReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportTableDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task SetCompareDangerTypeCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareVType}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareDangerTypeCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareVType}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableDangerTypeCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareVType}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableDangerTypeCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareVType}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task SetCompareDangerCategoryCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareVCategory}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareDangerCategoryCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareVCategory}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableDangerCategoryCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareVCategory}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableDangerCategoryCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareVCategory}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task SetCompareDangerDirectDepartmentCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareDirectDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareDangerDirectDepartmentCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareDirectDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableDangerDirectDepartmentCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareDirectDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableDangerDirectDepartmentCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareDirectDepartment}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task SetCompareDangerSpecialtyCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareSpecialty}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareDangerSpecialtyCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareSpecialty}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableDangerSpecialtyCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareSpecialty}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableDangerSpecialtyCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareSpecialty}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task SetCompareDangerKeyWorkCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareKeyWork}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareDangerKeyWorkCheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareKeyWork}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableDangerKeyWorkCheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareKeyWork}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableDangerKeyWorkCheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareKeyWork}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task SetCompareDangerHSECheckCountAsync(QHSEReportInputModel input, List<string> strings, string type, CompareReportModel result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareHSE}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }
    public async Task<CompareReportModel> GetCompareDangerHSECheckCountAsync(QHSEReportInputModel input, List<string> strings, string type)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string checkTypes = string.Join("-", strings);
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareHSE}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}-{checkTypes}-{type}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<CompareReportModel>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task<List<TableTimeReport>> GetTableDangerHSECheckCountAsync(QHSEReportInputModel input)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareHSE}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                var jsonData = await CacheHelper.GetAsync<string>(cacheKey);

                if (jsonData != null)
                {
                    var jsonSerializerOptions = new JsonSerializerOptions();
                    jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
                    return JsonSerializer.Deserialize<List<TableTimeReport>>(jsonData, jsonSerializerOptions);
                }
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    public async Task SetTableDangerHSECheckCountAsync(QHSEReportInputModel input, List<TableTimeReport> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEDangerReportCompareHSE}{input.OrganizationId}-{input.TimeOn1}-{input.TimeEnd1}-{input.TimeOn2}-{input.TimeEnd2}";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new DateTimeNullableJsonConverter());
        var jsonData = JsonSerializer.Serialize(result, jsonSerializerOptions);

        await CacheHelper.SetAsync(cacheKey, jsonData);
    }

    public async Task SetOrganizationAsync(List<AntTreeNode> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEOrganization}"+"Tree";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
       await SetCacheItemAsync(cacheKey, result);
    }
    public async Task<List<AntTreeNode>> GetOrganizationAsync()
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEOrganization}" + "Tree";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                    return await GetCacheItemsAsync<AntTreeNode>(cacheKey);
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }

    public async Task SetOrganizationAsync(IdInputModel inputModel, List<AntTreeNode> result)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEOrganization}{inputModel.Id}" + "Tree";
        // 存储当前时间戳到缓存
        await CacheHelper.SetAsync($"{cacheKey}-Timestamp", currentTicks.ToString());
        await SetCacheItemAsync(cacheKey, result);
    }
    public async Task<List<AntTreeNode>> GetOrganizationAsync(IdInputModel inputModel)
    {
        DateTime currentTime = DateTime.UtcNow;
        long currentTicks = currentTime.Ticks;
        string cacheKey = $"{CacheKeyConst.QHSEOrganization}{inputModel.Id}" + "Tree";
        // 获取缓存中的时间戳
        var timestampString = await CacheHelper.GetAsync<string>($"{cacheKey}-Timestamp");
        long cachedTimestamp;

        if (long.TryParse(timestampString, out cachedTimestamp))
        {
            // 判断是否在60分钟内
            if (currentTicks - cachedTimestamp <= TimeSpan.FromHours(24).Ticks)
            {
                return await GetCacheItemsAsync<AntTreeNode>(cacheKey);
            }
        }

        return null; // 根据业务需求返回合适的默认值
    }
    #region ActionClass 缓存

    public async Task<List<string>> GetActionClassAsync()
    {
        return await GetCacheItemsAsync<string>(CacheKeyConst.ActionClass);
    }

    public async Task SetActionClassAsync(List<string> actionClasss)
    {
        await SetCacheItemAsync<string>(CacheKeyConst.ActionClass, actionClasss);
    }

    public async Task RemoveActionClassAsync()
    {
        await RemoveCacheAsync(CacheKeyConst.ActionClass);
    }

    #endregion
}
